Optimal. Leaf size=145 \[ b^3 B x+\frac {\left (3 a^2 A b+2 A b^3+a^3 B+6 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a \left (2 a^2 A+8 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a^2 (5 A b+3 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {a A (a+b \cos (c+d x))^2 \sec ^2(c+d x) \tan (c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.23, antiderivative size = 145, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3068, 3110,
3100, 2814, 3855} \begin {gather*} \frac {a \left (2 a^2 A+9 a b B+8 A b^2\right ) \tan (c+d x)}{3 d}+\frac {a^2 (3 a B+5 A b) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {\left (a^3 B+3 a^2 A b+6 a b^2 B+2 A b^3\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a A \tan (c+d x) \sec ^2(c+d x) (a+b \cos (c+d x))^2}{3 d}+b^3 B x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2814
Rule 3068
Rule 3100
Rule 3110
Rule 3855
Rubi steps
\begin {align*} \int (a+b \cos (c+d x))^3 (A+B \cos (c+d x)) \sec ^4(c+d x) \, dx &=\frac {a A (a+b \cos (c+d x))^2 \sec ^2(c+d x) \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \cos (c+d x)) \left (a (5 A b+3 a B)+\left (2 a^2 A+3 A b^2+6 a b B\right ) \cos (c+d x)+3 b^2 B \cos ^2(c+d x)\right ) \sec ^3(c+d x) \, dx\\ &=\frac {a^2 (5 A b+3 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {a A (a+b \cos (c+d x))^2 \sec ^2(c+d x) \tan (c+d x)}{3 d}-\frac {1}{6} \int \left (-2 a \left (2 a^2 A+8 A b^2+9 a b B\right )-3 \left (3 a^2 A b+2 A b^3+a^3 B+6 a b^2 B\right ) \cos (c+d x)-6 b^3 B \cos ^2(c+d x)\right ) \sec ^2(c+d x) \, dx\\ &=\frac {a \left (2 a^2 A+8 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a^2 (5 A b+3 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {a A (a+b \cos (c+d x))^2 \sec ^2(c+d x) \tan (c+d x)}{3 d}-\frac {1}{6} \int \left (-3 \left (3 a^2 A b+2 A b^3+a^3 B+6 a b^2 B\right )-6 b^3 B \cos (c+d x)\right ) \sec (c+d x) \, dx\\ &=b^3 B x+\frac {a \left (2 a^2 A+8 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a^2 (5 A b+3 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {a A (a+b \cos (c+d x))^2 \sec ^2(c+d x) \tan (c+d x)}{3 d}-\frac {1}{2} \left (-3 a^2 A b-2 A b^3-a^3 B-6 a b^2 B\right ) \int \sec (c+d x) \, dx\\ &=b^3 B x+\frac {\left (3 a^2 A b+2 A b^3+a^3 B+6 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {a \left (2 a^2 A+8 A b^2+9 a b B\right ) \tan (c+d x)}{3 d}+\frac {a^2 (5 A b+3 a B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {a A (a+b \cos (c+d x))^2 \sec ^2(c+d x) \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.64, size = 108, normalized size = 0.74 \begin {gather*} \frac {6 b^3 B d x+3 \left (3 a^2 A b+2 A b^3+a^3 B+6 a b^2 B\right ) \tanh ^{-1}(\sin (c+d x))+3 a \left (2 a^2 A+6 A b^2+6 a b B+a (3 A b+a B) \sec (c+d x)\right ) \tan (c+d x)+2 a^3 A \tan ^3(c+d x)}{6 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.28, size = 180, normalized size = 1.24
method | result | size |
derivativedivides | \(\frac {-A \,a^{3} \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+a^{3} B \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 A \,a^{2} b \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 a^{2} b B \tan \left (d x +c \right )+3 A a \,b^{2} \tan \left (d x +c \right )+3 B a \,b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+A \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+b^{3} B \left (d x +c \right )}{d}\) | \(180\) |
default | \(\frac {-A \,a^{3} \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+a^{3} B \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 A \,a^{2} b \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 a^{2} b B \tan \left (d x +c \right )+3 A a \,b^{2} \tan \left (d x +c \right )+3 B a \,b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+A \,b^{3} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+b^{3} B \left (d x +c \right )}{d}\) | \(180\) |
risch | \(b^{3} B x -\frac {i a \left (9 A a b \,{\mathrm e}^{5 i \left (d x +c \right )}+3 B \,a^{2} {\mathrm e}^{5 i \left (d x +c \right )}-18 A \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-18 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}-12 A \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-36 A \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-36 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}-9 A a b \,{\mathrm e}^{i \left (d x +c \right )}-3 B \,a^{2} {\mathrm e}^{i \left (d x +c \right )}-4 a^{2} A -18 A \,b^{2}-18 B a b \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A b}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{3}}{d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a \,b^{2}}{d}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A b}{2 d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{3}}{d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a \,b^{2}}{d}\) | \(356\) |
norman | \(\frac {b^{3} B x \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+b^{3} B x \left (\tan ^{14}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b^{3} B x -\frac {8 a \left (a^{2} A -3 A \,b^{2}-3 B a b \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a \left (2 a^{2} A -3 A a b +6 A \,b^{2}-B \,a^{2}+6 B a b \right ) \left (\tan ^{13}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a \left (2 a^{2} A +3 A a b +6 A \,b^{2}+B \,a^{2}+6 B a b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {4 a \left (5 a^{2} A -9 A a b +9 A \,b^{2}-3 B \,a^{2}+9 B a b \right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {4 a \left (5 a^{2} A +9 A a b +9 A \,b^{2}+3 B \,a^{2}+9 B a b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {a \left (26 a^{2} A -45 A a b -18 A \,b^{2}-15 B \,a^{2}-18 B a b \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {a \left (26 a^{2} A +45 A a b -18 A \,b^{2}+15 B \,a^{2}-18 B a b \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-b^{3} B x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+3 b^{3} B x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+3 b^{3} B x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 b^{3} B x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 b^{3} B x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {\left (3 A \,a^{2} b +2 A \,b^{3}+a^{3} B +6 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (3 A \,a^{2} b +2 A \,b^{3}+a^{3} B +6 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(558\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 216, normalized size = 1.49 \begin {gather*} \frac {4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} A a^{3} + 12 \, {\left (d x + c\right )} B b^{3} - 3 \, B a^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 9 \, A a^{2} b {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 18 \, B a b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, A b^{3} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 36 \, B a^{2} b \tan \left (d x + c\right ) + 36 \, A a b^{2} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 189, normalized size = 1.30 \begin {gather*} \frac {12 \, B b^{3} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (B a^{3} + 3 \, A a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (B a^{3} + 3 \, A a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, A a^{3} + 2 \, {\left (2 \, A a^{3} + 9 \, B a^{2} b + 9 \, A a b^{2}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 336 vs.
\(2 (137) = 274\).
time = 0.61, size = 336, normalized size = 2.32 \begin {gather*} \frac {6 \, {\left (d x + c\right )} B b^{3} + 3 \, {\left (B a^{3} + 3 \, A a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (B a^{3} + 3 \, A a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (6 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 18 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 18 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 4 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 36 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 36 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.95, size = 526, normalized size = 3.63 \begin {gather*} \frac {\frac {A\,a^3\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {B\,a^3\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {A\,a^3\,\sin \left (c+d\,x\right )}{2}+\frac {3\,A\,a\,b^2\,\sin \left (c+d\,x\right )}{4}+\frac {3\,B\,a^2\,b\,\sin \left (c+d\,x\right )}{4}-\frac {A\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{2}-\frac {B\,a^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}+\frac {3\,B\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+\frac {3\,A\,a^2\,b\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {3\,A\,a\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {3\,B\,a^2\,b\,\sin \left (3\,c+3\,d\,x\right )}{4}-\frac {A\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{2}-\frac {B\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}+\frac {B\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {A\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{4}-\frac {B\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{2}-\frac {A\,a^2\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{4}-\frac {B\,a\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{2}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________